package cn.edu.scau.cmi.wangmaoren.client.spring;

import org.springframework.context.ApplicationContext;
import cn.edu.scau.cmi.wangmaoren.spring.domain.Student;
import cn.edu.scau.cmi.wangmaoren.spring.domain.Teacher;
import cn.edu.scau.cmi.wangmaoren.spring.util.ApplicationContextUtil;

public class Spring03SingletonApplicationContextClient
{

	private static Teacher liangzaoqing;
	private static Student zhangsan;

	public Spring03SingletonApplicationContextClient()
	{
	}

	public static void main(String[] args)
	{
		ApplicationContext ac = getApplicationContext();
		Student student = (Student) ac.getBean("zhangsan");
		System.out.println(student.getName() + "的毕业设计指导导师是：" + student.getTutor().getName());
	}

	private static ApplicationContext getApplicationContext()
	{
		ApplicationContext applicationContext = ApplicationContextUtil.getApplicationContext();
		return applicationContext;
	}

}
